/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package sfs2x.extension.fourinaline.src.main;

import sfs2x.extension.fourinaline.src.ClientRequest.AddResquestHandle;
import com.smartfoxserver.v2.core.SFSEventType;
import com.smartfoxserver.v2.extensions.SFSExtension;
import sfs2x.extension.fourinaline.src.utils.Commands;

/**
 *
 * @author dodinhchien
 */
public class FourInRowExtension extends SFSExtension {

    @Override
    public void init() {
        // Event handler: user login 
        addEventHandler(SFSEventType.USER_LOGIN, UserLoginEventHandler.class);
        
        // Event handler: user logout
        addEventHandler(SFSEventType.USER_LOGOUT, UserLogoutEventHandle.class);
        
        // Event handler: user join game room
        addEventHandler(SFSEventType.USER_JOIN_ROOM, UserJoinRoomEventHandle.class);
        
        // Event handler: user leave game room
        addEventHandler(SFSEventType.USER_LEAVE_ROOM, UserLeaveRoomEventHandler.class);
        
        // add request to handle CLIENT_REQUEST_COMMAND_ADD command
        addRequestHandler(Commands.CLIENT_REQUEST_COMMAND_ADD, AddResquestHandle.class);
        
    }
    
    @Override
    public void destroy() {
        trace("fourinaline extension stopped.");
        super.destroy();
    }
}
